perm filename TANGLE.DIF[WEB,ALS] blob sn#625335 filedate 1981-11-21 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00005 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00003 00002	  1) TANGLE.WEB[WEB,DEK] and 2) TANGLE.WEB[TEX,DRF]	11-21-81 20:17	pages 1,1
C00010 00003	**** File 1) TANGLE.WEB[WEB,DEK]/4P/50L
C00013 00004	**** File 1) TANGLE.WEB[WEB,DEK]/4P/91L
C00022 00005	  1) TANGLE.WEB[WEB,DEK] and 2) TANGLE.WEB[TEX,DRF]	11-21-81 20:17	pages 7,7
C00027 ENDMK
C⊗;
  1) TANGLE.WEB[WEB,DEK] and 2) TANGLE.WEB[TEX,DRF]	11-21-81 20:17	pages 1,1

**** File 1) TANGLE.WEB[WEB,DEK]/4P/1L
1)	@* Input and output.
**** File 2) TANGLE.WEB[TEX,DRF]/3P/156L
2)	@d carriage_return=@'15 {ascii code (control-M) used at end of line}
2)	@d line_feed=@'12 {ascii code (control-J) not used at end of line}
2)	@d form_feed=@'14	{ascii code (control-L) used at end of page}
2)	@d tab_mark=@'11	{ascii code (control-I) used as tab-skip}
2)	@* Input and output.
***************


**** File 1) TANGLE.WEB[WEB,DEK]/4P/23L
1)	@ The following code re-opens the |input| file in a mode that (a)↔allows us
1)	to see end-of-line characters, and (b)↔does not get the first character;
1)	@↑system dependencies@>
1)	the first |read_ln| does the first |get|. The procedure returns |true| if
1)	the file could not be opened.
1)	@p function open_input:boolean; {prepare for ascii input on the |input| file}
1)	begin reset(input,'','/E/I/O');
1)	open_input←eof(input);
1)	end;
**** File 2) TANGLE.WEB[TEX,DRF]/4P/23L
2)	@ The following code re-opens the |input| file in a mode that allows us
2)	@↑system dependencies@>
2)	to see end-of-line characters.
2)	@p procedure open_input; {prepare for ascii input on the |input| file}
2)	begin reset(input,'','/E');
2)	end;
***************


**** File 1) TANGLE.WEB[WEB,DEK]/4P/38L
1)	type |ascii_code|, which is a subrange of the integers. The |ord| and |chr|
1)	functions of \PASCAL\ are used to convert to and from |ascii_code| numbers.
1)	@<Types...@>=
**** File 2) TANGLE.WEB[TEX,DRF]/4P/35L
2)	type |ascii_code|, which is a subrange of the integers. The |xord| and |xchr|
2)	arrays are used to convert to and from |ascii_code| numbers.
2)	@<Types...@>=
***************


**** File 1) TANGLE.WEB[WEB,DEK]/4P/45L
1)	@ String pool constants are written to the |pool| file.
**** File 2) TANGLE.WEB[TEX,DRF]/4P/42L
2)	@ 
2)	@<Globals...@>=
2)	@!xord: array[char] of ascii_code;
2)	@!xchr: array[ascii_code] of char;
2)	@ 
2)	@<Local variables for initialization@>=
2)	i:integer;
2)	@ 
2)	@<Set initial...@>=
2)	xchr[1]←'↓'; xchr[2]←'α'; xchr[3]←'β'; xchr[4]←chr(and_sign);
2)	xchr[5]←chr(not_sign); xchr[6]←chr(set_element_sign); xchr[7]←'π';
2)	xchr[8]←'λ'; xchr[9]←chr(tab_mark); xchr[10]←chr(line_feed); xchr[11]←'';
2)	xchr[12]←chr(form_feed); xchr[13]←chr(carriage_return); xchr[14]←'∞';
2)	xchr[15]←'∂'; xchr[16]←'⊂'; xchr[17]←'⊃'; xchr[18]←'∩'; xchr[19]←'∪';
2)	xchr[20]←'∀'; xchr[21]←'∃'; xchr[22]←'⊗'; xchr[23]←'↔'; xchr[24]←'_';
2)	xchr[25]←'→'; xchr[26]←chr(26); xchr[27]←chr(not_equal);
2)	xchr[28]←chr(less_or_equal); xchr[29]←chr(greater_or_equal);
2)	xchr[30]←chr(equivalence_sign); xchr[31]←chr(or_sign); xchr[32]←' ';
2)	xchr[33]←'!'; xchr[34]←'"'; xchr[35]←'#'; xchr[36]←'$'; xchr[37]←'%';
2)	xchr[38]←'&'; xchr[39]←''''; xchr[40]←'('; xchr[41]←')'; xchr[42]←'*';
2)	xchr[43]←'+'; xchr[44]←','; xchr[45]←'-'; xchr[46]←'.'; xchr[47]←'/';
2)	xchr[48]←'0'; xchr[49]←'1'; xchr[50]←'2'; xchr[51]←'3'; xchr[52]←'4';
2)	xchr[53]←'5'; xchr[54]←'6'; xchr[55]←'7'; xchr[56]←'8'; xchr[57]←'9';
2)	xchr[58]←':'; xchr[59]←';'; xchr[60]←'<'; xchr[61]←'='; xchr[62]←'>';
2)	xchr[63]←'?'; xchr[64]←'@@'; xchr[65]←'A'; xchr[66]←'B'; xchr[67]←'C';
2)	xchr[68]←'D'; xchr[69]←'E'; xchr[70]←'F'; xchr[71]←'G'; xchr[72]←'H';
2)	xchr[73]←'I'; xchr[74]←'J'; xchr[75]←'K'; xchr[76]←'L'; xchr[77]←'M';
2)	xchr[78]←'N'; xchr[79]←'O'; xchr[80]←'P'; xchr[81]←'Q'; xchr[82]←'R';
2)	xchr[83]←'S'; xchr[84]←'T'; xchr[85]←'U'; xchr[86]←'V'; xchr[87]←'W';
2)	xchr[88]←'X'; xchr[89]←'Y'; xchr[90]←'Z'; xchr[91]←'['; xchr[92]←'\';
2)	xchr[93]←']'; xchr[94]←'↑'; xchr[95]←chr(left_arrow); xchr[96]←'`';
2)	xchr[97]←'a'; xchr[98]←'b'; xchr[99]←'c'; xchr[100]←'d'; xchr[101]←'e';
2)	xchr[102]←'f'; xchr[103]←'g'; xchr[104]←'h'; xchr[105]←'i'; xchr[106]←'j';
2)	xchr[107]←'k'; xchr[108]←'l'; xchr[109]←'m'; xchr[110]←'n'; xchr[111]←'o';
2)	xchr[112]←'p'; xchr[113]←'q'; xchr[114]←'r'; xchr[115]←'s'; xchr[116]←'t';
2)	xchr[117]←'u'; xchr[118]←'v'; xchr[119]←'w'; xchr[120]←'x'; xchr[121]←'y';
2)	xchr[122]←'z'; xchr[123]←'{'; xchr[124]←'|'; xchr[125]←'}';
2)	for i:=1 to 125 do xord[xchr[i]]←i;
2)	@ String pool constants are written to the |pool| file.
***************


**** File 1) TANGLE.WEB[WEB,DEK]/4P/50L
1)	@ The following code opens |pool| and checks to make sure that the external
1)	file is available for writing.
1)	@↑system dependencies@>
1)	@<Set init...@>=
1)	rewrite(pool,'','/O');
1)	if not eof(pool) then
1)		begin print_nl('! Couldn''t open the pool file.'); quit;
1)		end;
1)	@ Input goes into an array called |buffer|.
**** File 2) TANGLE.WEB[TEX,DRF]/4P/88L
2)	@ The following code opens |pool|.
2)	@<Set init...@>=
2)	rewrite(pool);
2)	@ Input goes into an array called |buffer|.
***************


**** File 1) TANGLE.WEB[WEB,DEK]/4P/75L
1)	@d carriage_return=@'15 {ascii code (control-M) used at end of line}
1)	@d form_feed=@'14	{ascii code (control-L) used at end of page}
1)	@d tab_mark=@'11	{ascii code (control-I) used as tab-skip}
1)	@p function input_ln:boolean; {inputs the next line or returns |false|}
1)	begin read_ln; {|get| the first character of the line}
1)	if eof(input) then input_ln←false
1)	else	begin limit←0; buffer[0]←ord(input↑);
1)		if buffer[0]≠form_feed then {not end of page}
1)			while buffer[limit]≠carriage_return do
1)				if limit=buf_size-1 then {keep |buffer[buf_size]| empty}
**** File 2) TANGLE.WEB[TEX,DRF]/4P/108L
2)	@p function input_ln:boolean; {inputs the next line or returns |false|}
2)	begin
2)	if eof(input) then input_ln←false
2)	else	begin limit←0;
2)		buffer[0]←xord[input↑];
2)		if buffer[0]=form_feed then get(input)
2)		else	if eoln(input) and (xord[input↑]≠"≠") then {Stanford bug}
2)				begin buffer[0]←carriage_return; read_ln(input); end
2)			else while buffer[limit]≠carriage_return do
2)				if limit=buf_size-1 then {keep |buffer[buf_size]| empty}
***************


**** File 1) TANGLE.WEB[WEB,DEK]/4P/91L
1)					else buffer[limit]←ord(input↑);
1)					end;
**** File 2) TANGLE.WEB[TEX,DRF]/4P/123L
2)					else if eoln(input) and (xord[input↑]≠"≠") then
2)						begin buffer[limit]←carriage_return;
2)						read_ln(input);
2)						end
2)					else buffer[limit]←xord[input↑];
2)					end;
***************


**** File 1) TANGLE.WEB[WEB,DEK]/5P/53L
1)		else print(chr(buffer[k-1])); {print the characters already read}
1)	print_ln('');
1)	for k←1 to l do print(' '); {space out the next line}
1)	for k←l+1 to limit do print(chr(buffer[k-1])); {print the part not yet read}
1)	print(' '); {this space separates the message from future page numbers}

**** File 2) TANGLE.WEB[TEX,DRF]/5P/53L
2)		else print(xchr[buffer[k-1]]); {print the characters already read}
2)	print_ln('');
2)	for k←1 to l do print(' '); {space out the next line}
2)	for k←l+1 to limit do print(xchr[buffer[k-1]]); {print the part not yet read}
2)	print(' '); {this space separates the message from future page numbers}
***************


**** File 1) TANGLE.WEB[WEB,DEK]/5P/66L
1)	for j←1 to out_ptr do print(chr(out_buf[j-1])); {print current partial line}
1)	print('...'); {indicate that this information is partial}
**** File 2) TANGLE.WEB[TEX,DRF]/5P/66L
2)	for j←1 to out_ptr do print(xchr[out_buf[j-1]]); {print current partial line}
2)	print('...'); {indicate that this information is partial}
***************


**** File 1) TANGLE.WEB[WEB,DEK]/6P/140L
1)	else for k←byte_start[p] to byte_start[p+1]-1 do print(chr(byte_mem[k]));
1)	end;
**** File 2) TANGLE.WEB[TEX,DRF]/6P/140L
2)	else for k←byte_start[p] to byte_start[p+1]-1 do print(xchr[byte_mem[k]]);
2)	end;
***************


**** File 1) TANGLE.WEB[WEB,DEK]/7P/203L
1)	for k←byte_start[q] to byte_start[q+1]-1 do print(chr(byte_mem[k]));
1)	error; q←0; {only one conflict will be printed, since |equiv[0]=0|}
**** File 2) TANGLE.WEB[TEX,DRF]/7P/203L
2)	for k←byte_start[q] to byte_start[q+1]-1 do print(xchr[byte_mem[k]]);
2)	error; q←0; {only one conflict will be printed, since |equiv[0]=0|}
***************


**** File 1) TANGLE.WEB[WEB,DEK]/7P/214L
1)		write(pool,chr(@'37+l-double_chars)); {output string length plus |@'40|}
1)		i←id_first+1;
1)		while i<id_loc do
1)			begin write(pool,chr(buffer[i])); {output characters of string}
1)			if (buffer[i]="""") ∨ (buffer[i]="@@") then
**** File 2) TANGLE.WEB[TEX,DRF]/7P/214L
2)		write(pool,xchr[@'37+l-double_chars]); {output string length plus |@'40|}
2)		i←id_first+1;
2)		while i<id_loc do
2)			begin write(pool,xchr[buffer[i]]); {output characters of string}
2)			if (buffer[i]="""") ∨ (buffer[i]="@@") then
  1) TANGLE.WEB[WEB,DEK] and 2) TANGLE.WEB[TEX,DRF]	11-21-81 20:17	pages 7,7

***************


**** File 1) TANGLE.WEB[WEB,DEK]/9P/107L
1)		print('@@{',a:0,'@@',chr("}")); {can't use right brace in comments}
1)		end;
**** File 2) TANGLE.WEB[TEX,DRF]/9P/107L
2)		print('@@{',a:0,'@@',xchr["}"]); {can't use right brace in comments}
2)		end;
***************


**** File 1) TANGLE.WEB[WEB,DEK]/9P/114L
1)	end_comment: print('@@',chr("}")); {can't use right brace in comments}
1)	octal: print('@@''');
**** File 2) TANGLE.WEB[TEX,DRF]/9P/114L
2)	end_comment: print('@@',xchr["}"]); {can't use right brace in comments}
2)	octal: print('@@''');
***************


**** File 1) TANGLE.WEB[WEB,DEK]/9P/118L
1)	othercases print(chr(a))
1)	endcases
**** File 2) TANGLE.WEB[TEX,DRF]/9P/118L
2)	othercases print(xchr[a])
2)	endcases
***************


**** File 1) TANGLE.WEB[WEB,DEK]/11P/132L
1)	for k←1 to break_ptr do write(chr(out_buf[k-1]));
1)	write_ln; incr(line);
**** File 2) TANGLE.WEB[TEX,DRF]/11P/132L
2)	for k←1 to break_ptr do write(xchr[out_buf[k-1]]);
2)	write_ln; incr(line);
***************


**** File 1) TANGLE.WEB[WEB,DEK]/13P/32L
1)	if open_input then {something wrong with the |input| file}
1)		begin print_nl('! Couldn''t open the input file.'); quit;
1)		end;
1)	page←0; line←0; limit←0; loc←1; buffer[0]←" ";
**** File 2) TANGLE.WEB[TEX,DRF]/13P/32L
2)	open_input;
2)	page←0; line←0; limit←0; loc←1; buffer[0]←" ";
***************


**** File 1) TANGLE.WEB[WEB,DEK]/14P/159L
1)		for j←1 to 25 do print(chr(module[j]));
1)		print('...');
**** File 2) TANGLE.WEB[TEX,DRF]/14P/159L
2)		for j←1 to 25 do print(xchr[module[j]]);
2)		print('...');
***************


**** File 1) TANGLE.WEB[WEB,DEK]/16P/71L
1)		else	begin err_print('! @@',chr(buffer[loc-1]),
1)				' is ignored in PASCAL text'); goto continue;
**** File 2) TANGLE.WEB[TEX,DRF]/16P/71L
2)		else	begin err_print('! @@',xchr[buffer[loc-1]],
2)				' is ignored in PASCAL text'); goto continue;
***************


**** File 1) TANGLE.WEB[WEB,DEK]/18P/55L
1)		3: for k←1 to dd do print(chr(buffer[k]));
1)		4: for k←1 to dd do print(chr(module[k]));
1)		5: for k←1 to out_ptr do print(chr(out_buf[k]));
1)		6: for k←1 to dd do print(chr(out_contrib[k]));
1)		othercases print('?')
**** File 2) TANGLE.WEB[TEX,DRF]/18P/55L
2)		3: for k←1 to dd do print(xchr[buffer[k]]);
2)		4: for k←1 to dd do print(xchr[module[k]]);
2)		5: for k←1 to out_ptr do print(xchr[out_buf[k]]);
2)		6: for k←1 to dd do print(xchr[out_contrib[k]]);
2)		othercases print('?')
***************